(function(angular) {
	"use strict";
	angular.module("fs.waf").controller("cls.mgl.viewController", viewController);
	viewController.$inject = [ "$scope", "gridService", "modalService", "layoutConfig", "validatorConfig", "authService", "mglService" ];
	function viewController($scope, gridService, modalService, layoutConfig, validatorConfig, authService, mglService) {
		var ctrl = this, params = $scope.$stateParams.params;
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.effectiveDateReadonly = true;
		ctrl.init = function() {

			ctrl.mglentrydetailsGridOptions = gridService.createInnerGridOptions($scope, ctrl.layoutConfig.formConfigs.mglDetail.tableConfigs.table, null);
			ctrl.mglentrydetailsGridOptions.data = "vm.mgl.mglentrydetails";
			ctrl.itemTypeOptions = [ {
				"value" : "F",
				"label" : "label.global.fee"
			}, {
				"value" : "P",
				"label" : "label.global.principal"
			}, {
				"value" : "I",
				"label" : "label.global.interest"
			} ];
			authService.view(params).then(function(response) {
				if (response.data) {
					ctrl.mgl = response.data;
				}
			});
		};
	}
})(angular);
